package com.esd.device.controller;

import org.apache.shiro.SecurityUtils;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class IndexController {

    @RequestMapping("/")
    public String index() {
        Object principal = SecurityUtils.getSubject().getPrincipal();
        if (principal == null){
            return "login/login";
        }
        return "main";
    }

    @ResponseBody
    @GetMapping("ping")
    public String ping(){
        return "pong";
    }

}
